Type Alias: MutationOptions<TData, TError, TVariables>
MutationOptions<
TData
,TError
,TVariables
>:Omit
<UseMutationOptions
<TData
,TError
,TVariables
>,"mutationKey"
|"mutationFn"
>
See Tanstack Query - useMutation options.
Type Parameters
• TData = unknown
The data returned.
• TError = unknown
The error returned.
• TVariables = unknown
The variables used in the mutation.
See
Tanstack Query - useMutation
Options
mutationKey
andmutationFn
are used internally and therefore not included in the options.
mutation: {
gcTime,
meta,
- mutationFn,
- mutationKey,
networkMode,
onError,
onMutate,
onSettled,
onSuccess,
retry,
retryDelay,
scope,
throwOnError,
}
Example
useMutationHook({
mutation: {
onSuccess: (data, variables) => {
console.log('onSuccess callback', data, variables);
},
onError: (error) => {
console.log('onError callback', error);
},
},
})